# app/main.py

# 需要离线运行时使用
from fastapi_offline import FastAPIOffline as FastAPI

# 需要有最新特性开发时使用（推荐）
# from fastapi import FastAPI

from app.utils.logger import setup_logger
setup_logger()
from app.core import settings  # 导入配置
from app.api import v1_router, v2_router # 导入路由


# 创建 FastAPI 应用实例，可以从配置中获取标题等元数据
app = FastAPI(
    title=settings.PROJECT_NAME,
    description=settings.PROJECT_DESCRIPTION,
    version=settings.PROJECT_VERSION,
    openapi_url=f"/openapi.json",
    docs_url=f"/docs",
    redoc_url=f"/redoc",
)

app.include_router(
    v1_router, 
    prefix="/api/v1", 
    tags=[f"{settings.PROJECT_NAME} V1"]
)
app.include_router(
    v2_router, 
    prefix="/api/v2", 
    tags=[f"{settings.PROJECT_NAME} V2"]
)

@app.get("/")
async def root():
    return {
        "message": "路径规划模块API已启动!!!",
        "data": {
            "documentation": "/docs",
            "redoc": "/redoc",
            "v1_api": "/api/v1",
            "v2_api": "/api/v2"
        },
    }